<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Detail extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 */
	public function index($string=NULL)
	{
		$data['stylesheet'] = '/theme/' ;
		$data['image_path'] = '/theme/images/' ;

		$string = (strpos($string,'-')===0)?substr($string,1):$string ;
		$url_query = explode('-',$string) ;
		$rid = (int)!empty($url_query[0])?$url_query[0]:0 ;

		$this->load->model('mrecords');  
		$this->load->model('mrecordslist');  
		$data['detail'] = $this->mrecords->get_one($rid);  
		if (count((array)$data['detail']) == 0) {
			show_404();
			exit();
		}
		$data['detail_list'] = $this->mrecordslist->get_one($rid);  
		$data['user'] = $this->mrecords->get_user($data['detail']->uk);  
		$data['last_one'] = $this->mrecords->get_last($rid);  
		$data['next_one'] = $this->mrecords->get_next($rid);  
		$data['head_title'] = $data['detail']->title.'-盘享网' ;
		$data['keywords'] = '' ;
		$data['description'] = '' ;

		// --------浏览次数加1
		$arr['view_count'] = $data['detail']->view_count + 1 ;
		$this->mrecords->update($rid,$arr);  

		$this->load->view('header',$data);
		$this->load->view('detail_index');
		$this->load->view('footer');
	}
}